/*
 * Created on 2006-2-22
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package cn.com.sbell.vss.csg.vap;

import org.dom4j.Element;

import cn.com.sbell.vss.csg.vap.bean.PresetPTZ;
import cn.com.sbell.vss.csg.vsclient.VsClient;
import cn.com.sbell.vss.csg.vsclient.util.PropertiesHolder;

/**
 * @author liang.a.chen
 * 
 * TODO To change the template for this generated type comment go to Window -
 * Preferences - Java - Code Style - Code Templates
 */
public class GetPresetPTZ extends ProtectedVsCommander {

	protected Element executeCommand(VsClient vsClient,
			PropertiesHolder holder, Element root) {
		int ptzId = holder.getIntProperty("ptzId").intValue();
		PresetPTZ[] presets = vsClient.getPresetPTZ(ptzId);
		for (int i = 0; i < presets.length; i++) {
			Element preset = root.addElement("preset");
			preset.addElement("presetIndex").addText(toString(presets[i].getPresetIndex()));
			preset.addElement("presetName").addText(toString(presets[i].getPresetName()));
		}
		return root;
	}
}
